Modern computer systems are frequently faced with the task of identifying (i.e., noting the value and location of) an extreme (i.e., minimum or maximum) value in a data array. The challenge, however, is how to do so quickly and efficiently. Given an array x[N] having N elements, and assuming max_value is to contain the maximum value and max_index is to contain its location in the array, Table 1, below, expresses in C code the general software algorithm for searching an array for the maximum value contained in it:
TABLE 1A General Software Algorithm for Searching an Arrayfor a Maximum Valuemax_value = x[0];max_index = 0;for(i=1;i<N;i++) { if(x[i]>max_value) {  max_value = x[i];  max_index = i; }}
Likewise, assuming min_value is to contain the minimum value and min_index is to contain its location in the array, Table 2, below, expresses in C code the general software algorithm for searching an array for the minimum value contained in it:
TABLE 2A General Software Algorithm for Searching an Arrayfor a Minimum Valuemin_value = x[0];min_index = 0;for(i=1;i<N;i++) { if(x[i]<min_value) {  min_value = x[i];  min_index = i; }}
Unfortunately, the best conventional software algorithms for performing this task require multiple computer instructions to perform each step of the search. Further, these algorithms work better with some value and index sizes than others. For example, in the ZSP400® (a conventional single-instruction, multiple-data, or SIMD, processing unit commercially available from VeriSilicon, Inc., of Santa Clara, Calif.), a search for a maximum 16-bit value can be carried out with a 16-bit index by maintaining the index in the low 16-bits of a 32-bit register and executing the first algorithm set forth above. However, this approach does not scale up to 32-bit indexes. And, as noted above, each step of the search requires multiple computer instructions.